package guda.demox.web.config;


import guda.demox.web.interceptor.LoggerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by well on 17/6/9.
 */

@EnableWebMvc
@EnableAutoConfiguration
@MapperScan( basePackages = {"guda.demox.dal", "guda.demox.dal.outer"})
@ComponentScan(basePackages = {"guda.demox"})
public class AppWebConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private LoggerInterceptor loggerInterceptor;

    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loggerInterceptor).addPathPatterns("/**");
    }

}
